<script setup>
defineProps({
  title: {
    required: true,
    type: String,
  },
})
</script>

<template>
  <el-card class="page-container">
    <template #header>
      <!-- <template>不可以嵌套，但是想使用多个<template>要通过if判断，或插槽使用 -->
      <!--  <slot></slot>  这是默认插槽     定义-->
      <!-- <template #default>
              <p>这是默认插槽的内容</p>
           </template>                     使用-->
      <div class="header">
        <span>{{ title }}</span>
        <div class="extra">
          <slot name="extra"></slot>
        </div>
      </div>
    </template>
    <slot></slot>
  </el-card>
</template>

<style lang="scss" scoped>
.page-container {
  min-height: 100%;
  box-sizing: border-box;
  .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}
</style>
